package com.atguigu.lease.common.sms;

import com.aliyun.dysmsapi20170525.Client;
import com.aliyun.teaopenapi.models.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * @ClassName: AliyunSmsConfiguration
 * @Description:
 * @Author: yangchengbao
 * @Create: 2025/1/4 13:10
 * @Version: 1.0
 */
@Configuration
public class AliyunSMSConfiguration {

    private final static String accessKeyId="LTAI5tKxaNXFsr4SqNPQkPpi";
    private final static String accessKeySecret="QMnj8x6j6K7dD3u3F1O7sKkPWni0Cd";
    private final static String endpoint="dysmsapi.aliyuncs.com";

    @Bean
    public Client smsClient() {
        Config config = new Config();
        config.setAccessKeyId(accessKeyId);
        config.setAccessKeySecret(accessKeySecret);
        config.setEndpoint(endpoint);
        try {
            return new Client(config);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }
}
